package com.ldatum.crm.serviceImpl;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import com.ldatum.crm.dao.TTracksDao;
import com.ldatum.crm.daoImpl.TTracksDaoImpl;
import com.ldatum.crm.domain.NewTracks;
import com.ldatum.crm.domain.TTracks;
import com.ldatum.crm.service.TTrackService;

public class TTrackServiceImpl implements TTrackService {
	TTracksDao tracksDao = new TTracksDaoImpl();
	@Override
	public TTracks findById(Class<TTracks> class1, int id) throws Exception {
		return tracksDao.findById(class1,id);
	}

	@Override
	public void save(TTracks tracks) throws Exception {
		if("".equals(tracks.getCreateDateTime()) | tracks.getCreateDateTime()==null){
			tracks.setCreateDateTime(new SimpleDateFormat("yyyy/MM/dd HH:mm").format(new Date()));
		}
		tracksDao.save(tracks);
	}

	@Override
	public List<TTracks> list(Class<TTracks> clazz, String employeeName)
			throws Exception {
		return tracksDao.list(clazz,employeeName);
	}

	@Override
	public List<NewTracks> list1(Class<NewTracks> clazz, String employeeName)
			throws Exception {
		
		return tracksDao.list1(clazz,employeeName);
	}

}
